/******************************************************
 * @file model_manager.c
 * @author Destiny 
 * @brief 模型管理
 * 
 * @version 0.1
 * @date 2024-07-18
 *****************************************************/
#include <string.h>
#include "config.h"
#include "model_manager.h"



static PT_ModelDisc g_ptModelDiscHead = NULL;


int RegisterModelDisc(PT_ModelDisc ptModelDisc)
{
	PT_ModelDisc ptTmp;

	if (!g_ptModelDiscHead)
	{
		g_ptModelDiscHead   = ptModelDisc;
		ptModelDisc->ptNext = NULL;
	}
	else
	{
		ptTmp = g_ptModelDiscHead;
		while (ptTmp->ptNext)
		{
			ptTmp = ptTmp->ptNext;
		}
		ptTmp->ptNext     = ptModelDisc;
		ptModelDisc->ptNext = NULL;
	}
	return 0;
}

void ShowModelDisc(void)
{
	int i = 0;
	PT_ModelDisc ptTmp = g_ptModelDiscHead;

	while (ptTmp)
	{
		printf("%02d %s\n", i++, ptTmp->name);
		ptTmp = ptTmp->ptNext;
	}
}

PT_ModelDisc GetModelDisc(char *pcName)
{
	PT_ModelDisc ptTmp = g_ptModelDiscHead;
	
	while (ptTmp)
	{
		if (strcmp(ptTmp->name, pcName) == 0)
		{
			return ptTmp;
		}
		ptTmp = ptTmp->ptNext;
	}
	return NULL;
}
int ModelInit(void)
{
	int iError;
	iError = MnisInit();
	if (iError)
	{
		DBG_PRINTF(DLOG_LVL_ERROR,DLOG_TAG,"MnisInit error!\n");
		return -1;
	}
	return 0;
}

